package lab6;

import static java.lang.Math.pow;
import static java.lang.Math.abs;

/**
 * Created with IntelliJ IDEA.
 * User: Борис
 * Date: 29.11.13
 * Time: 11:34
 * To change this template use File | Settings | File Templates.
 */
public class LabFiveRun {
    public static void main(String[] args){
        double a = 2;
        double b = 6;
        int degree = -6;
        double e = pow(10,degree);
        int accuracy = abs(degree);
        System.out.printf("%s%.0f%s%.0f%s %."+accuracy+"f ","1) Отрезок [",a,",",b,"], точность е = ",e);
        LabFive functionOne = new LabFive(e,1);
        functionOne.findRootOfTheEquation(a,b);
        double x = functionOne.getX();
        System.out.printf("\n%s%."+accuracy+"f","   Корень: x = ",x);
        System.out.printf("\n   %s%."+accuracy+"f%s %.0f","Проверка: f(",x,") = ",functionOne.checkDecision());
        a = 1;
        b = 6;
        System.out.printf("\n%s%.0f%s%.0f%s %."+accuracy+"f ","2) Отрезок [",a,",",b,"], точность е = ",e);
        LabFive functionTwo = new LabFive(e,2);
        functionTwo.findRootOfTheEquation(a,b);
        x = functionTwo.getX();
        System.out.printf("\n%s%."+accuracy+"f","   Корень: x = ",x);
        System.out.printf("\n   %s%."+accuracy+"f%s %.0f","Проверка: f(",x,") = ",functionTwo.checkDecision());
    }
}
